package se.citerus.dddsample.data;

import org.springframework.jdbc.core.JdbcTemplate;


public class ItineraryDataGenerator extends AbstractDataGenerator {

	public void loadItineraryData(JdbcTemplate jdbcTemplate) {
	    String legSql =
	      "insert into Leg (id, cargo_id, voyage_id, load_location_id, unload_location_id, load_time, unload_time, leg_index) " +
	      "values (?,?,?,?,?,?,?,?)";

	    Object [][] legArgs = {
	      // Cargo 5: Hongkong - Melbourne - Stockholm - Helsinki
	      {1,5,1,3,2,ts(1),ts(2),0},
	      {2,5,1,2,1,ts(3),ts(4),1},
	      {3,5,1,1,5,ts(4),ts(5),2},
	      // Cargo 6: Hamburg - Stockholm - Chicago - Tokyo
	      {4,6,2,6,1,ts(1),ts(2),0},
	      {5,6,2,1,7,ts(3),ts(4),1},
	      {6,6,2,7,4,ts(5),ts(6),2}
	    };
	    executeUpdate(jdbcTemplate, legSql, legArgs);
	}
}
